home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 5 / chrpro3.zip / CFBRECVD.CMD < prev    next >
OS/2 REXX Batch file  |  1991-01-21  |  6KB  |  191 lines

  1. * Program CFBRECVD - Accepts Received amounts for the ACCOUNTS file.
  2. * ACCTREC&N = string of individual receivables for each department.
  3. * DEPTCUR&N = the total of each element in ACCTREC&N
  4. * N = Department code             MM = receivables sequence numbers
  5. Use
  6. Select primary
  7. Store d+':ACCOUNT'+DF to mfile
  8. Use &MFILE index &MFILE
  9. Store '0' to N
  10. Find D1
  11. If #=0
  12.   ? 'ACCOUNTS file is missing the "D1" Department. '
  13.   Accept 'The file must be re-created. Press <retn> to exit' to XX
  14.   RETURN
  15. endif
  16. ? 'Now reading the Receivables amounts from the ACCOUNTS file.'
  17. Store ' ' to DEPTNAMS
  18. Store '    ' to deptrecs
  19. Store ' ' to deptytd
  20. Store ' ' to M
  21. Store ' ' to IN
  22. Do while .not. EOF .and. N<>'9' .and. account='D'
  23.   Store str(val(N)+1,1) to N
  24.   Store $(account,1,2) to inaccnt
  25.   Store DEPTNAMS+$(account,2,25) to DEPTNAMS
  26.   Store deptrecs+str(#,5) to deptrecs
  27.   Store ' ' to acctrec&N
  28.   Store # to I
  29.   Store $(inaccnt,2,1) to indept
  30.   Store M+$(account,2,1) to M
  31.   Store 'R'+indept to inrecv
  32.   Find &INRECV
  33.   If #=0
  34. ? 'Now appending a Receivables record for: ',$(deptnams,val(N)*25-23,23)
  35.     APPEND BLANK
  36.     Replace ACCOUNT with inrecv
  37.     Store deptytd+'     0.00    0.00' to deptytd
  38.     Store 0.00 to newpaid
  39.     Store '    0.00' to deptcur&N
  40.     Store str(#,5) to acctdat&N
  41.   else
  42.     Store deptytd+paidytd+str(prevowed,8,2) to deptytd
  43.     Store str(#,5) to acctdat&N
  44.     SKIP
  45.     Store 0 to II
  46.     Do while account=inrecv .and. len(acctdat&N)<40 .and..not.EOF
  47.       Store acctrec&N+str(newpaid,8,2)+'-'+$(newpdate,4,2) to acctrec&N
  48.       Store II+newpaid to II
  49.       Store acctdat&N+str(#,5) to acctdat&N
  50.       Store $(account,3,1) to IN
  51.       SKIP
  52.     enddo
  53.     Store ' '+IN+acctdat&N to acctdat&N
  54.     Store str(II,8,2) to deptcur&N
  55.   endif
  56.   GOTO I
  57.   Do while account=inaccnt .and. .not. EOF
  58.     SKIP
  59.   enddo
  60. enddo
  61. Store N to IN
  62. Store '0' to N
  63. Store ' ' to ESEL
  64. Store len(M)-1 to II
  65. Store $(M,2,II) to MM
  66. Do while ESEL<>'Q'
  67.   Store '0' to N
  68.   Erase
  69.   @ 0,1 say MFILE
  70.   @ 0,27 say 'ACCOUNTS RECEIVABLES             '+curdate
  71.   Do while N<>IN
  72.     Store val(N)+1 to I
  73.     Store str(I,1) to N
  74.     @ I*2,0 say $(deptnams,I*25-24,25)
  75.     @ I*2,26 say 'Prev.YTD:'+$(deptytd,I*17-15,17)+'  Curr.month: $'+deptcur&N
  76.     @ I*2+1,1 say acctrec&N
  77.   enddo
  78.   ?
  79.   ?      'Select  -  [A]dd amount        [R]eport '
  80.   Accept '           [C]hange Amount     [Q]uit   ' to ESEL
  81.   ?
  82.   Store T to inval1
  83.   Do while inval1
  84.     Store F to inval1
  85.     Do case
  86.     CASE !(ESEL)='A'
  87.       If len(esel)>1
  88.         Store $(esel,2,1) to xx
  89.       else
  90.         Accept '         Enter Department number' to XX
  91.       endif
  92.       Store $(xx,1,1) to M
  93.       If @(M,MM) = 0
  94.         Accept 'Invalid Department. Press <retn>' to xx
  95.       else
  96.        Store @(M,MM) to I
  97.        Store str(I,1) to N
  98.        Store (len(acctrec&N)-1)/11 to II
  99.        If II > 6
  100.        Accept 'Too many receivables in this Dept. Max is 7. Press <RETN>' to XX
  101.        else
  102.         Append blank
  103.         @ 20,0 say '         Enter RECEIVED amount -  $' get NEWPAID
  104.         READ
  105.         Store acctrec&N+str(newpaid,8,2)+'-'+$(date(),4,2) to acctrec&N
  106.         Store '>'+$(acctdat&N,2,len(acctdat&N)-1)+str(#,5) to acctdat&N
  107.         Store str(newpaid+val(deptcur&N),8,2) to deptcur&N
  108.         Replace newpdate with date()
  109.         Replace account with 'R'+N+str(val($(acctdat&N,2,1))+1,1)
  110.        endif
  111.       endif
  112.       CASE !(ESEL)='C'
  113.         If len(esel) > 1
  114.           Store $(esel,2,1) to xx
  115.         else
  116.           Accept 'Enter Department number' to XX
  117.         endif
  118.         Store $(xx,1,1) to M
  119.         Store @(M,MM) to I
  120.         If I=0
  121.           Accept 'Invalid Department. Press <RETURN>' to xx
  122.         else
  123.           Store str(I,1) to N
  124.           Accept 'Enter sequence number to edit' to xx
  125.           Store val(xx) to I
  126.           Store len(acctrec&N) to ILEN
  127.           If I < 1.or.I > (ILEN-1)/11
  128.             Accept 'Invalid sequence number. Press <RETURN>' to xx
  129.           else
  130.             Store val($(acctdat&N,I*5+3,5)) to II
  131.             GOTO II
  132.             Store val($(acctrec&N,I*11-9,8)) to II
  133.             Set raw on
  134.             @ 20,0 say 'Enter new RECEIVED amount - $' get newpaid
  135.             READ
  136.             Set raw off
  137.             If (ILEN-1)/11=I
  138.    Store $(acctrec&N,1,I*11-10)+str(newpaid,8,2)+'-'+$(date(),4,2) to acctrec&N
  139.             else
  140.               Store $(acctrec&N,1,I*11-10)+str(newpaid,8,2)+'-'+$(date(),4,2)+;
  141.               $(acctrec&N,I*11+2,ILEN) to acctrec&N
  142.             endif
  143.             Store str(val(deptcur&N)+newpaid-II,8,2) to deptcur&N
  144.             Store '>'+$(acctdat&N,2,len(acctdat&N)-1) to acctdat&N
  145.           endif
  146.         endif
  147.       CASE !(ESEL)='R'
  148.         Store '0' to N
  149.         Set format to print
  150.         @ 0,1 say MFILE
  151.         @ 0,27 say 'ACCOUNTS RECEIVABLES                   '+curdate
  152.         Do while N<>IN
  153.           Store val(N)+1 to I
  154.           Store str(I,1) to N
  155.           @ I*2,0 say $(deptnams,I*25-23,25)
  156.  @ I*2,26 say 'Prev.YTD:'+$(deptytd,I*17-15,17)+'  Curr.month: $'+deptcur&N
  157.           @ I*2+1,1 say acctrec&N
  158.         enddo
  159.         Eject
  160.         set format to screen
  161.       CASE !(ESEL)='Q'
  162.         Store 'Q' to ESEL
  163.         Store '0' to N
  164.         Do while N<>IN
  165.           Store str(val(N)+1,1) to N
  166.           If $(acctdat&N,1,1)<>' '
  167.             Store val($(acctdat&N,3,5)) to II
  168.             GOTO II
  169.             Store val(deptcur&N) to I
  170.             Replace newpaid with I
  171.             Store I+prevowed to I
  172.             Store val($(deptrecs,val(N)*5,5)) to II
  173.             GOTO II
  174.             Replace newpdate with str(I,8,2)
  175.           endif
  176.         enddo
  177.       otherwise
  178.         Accept 'Invalid entry. Please enter again' to ESEL
  179.         Store T to invaldd
  180.     endcase
  181.   enddo
  182. enddo
  183. Release ESEL,deptnams,deptrecs,deptytd,m,mm,in,inval1,indept,inrecv,ii,ilen
  184. Store '0' to N
  185. Do while N<>'9'
  186.   Store str(val(N)+1,1) to N
  187.   Release DEPTCUR&N,ACCTREC&N,ACCTDAT&N
  188. enddo
  189. Use
  190. RETURN
  191.